import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
/// 通用修改状态栏颜色的导航页
/* 
小米 单独设置打开时 会影响深色模式 如果需要可以提示用户
import 'package:device_info/device_info.dart';
Future<void> checkDeviceAndGuideSettings() async {
  DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
  AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;

  if (androidInfo.brand.toLowerCase() == 'xiaomi') {
    // 提示用户检查MIUI的"应用单独设置"
    showDialog(
      context: context,
      builder: (context) {
        return AlertDialog(
          title: const Text('MIUI设置提示'),
          content: const Text('为了获得最佳体验，请关闭应用的单独设置中的深色模式。'),
          actions: [
            TextButton(
              onPressed: () => Navigator.of(context).pop(),
              child: const Text('确定'),
            ),
          ],
        );
      },
    );
  }
}
 */
class StatusBarWrapper extends StatelessWidget {
  final Color statusBarColor;
  final Brightness statusBarIconBrightness;
  final Widget child;

  const StatusBarWrapper({
    super.key,
    required this.statusBarColor,
    required this.statusBarIconBrightness,
    required this.child,
  });

  @override
  Widget build(BuildContext context) {
    return AnnotatedRegion<SystemUiOverlayStyle>(
      value: SystemUiOverlayStyle(
        statusBarColor: statusBarColor,
        statusBarIconBrightness: statusBarIconBrightness,
      ),
      child: child,
    );
  }
}
